<%--
  Created by IntelliJ IDEA.
  User: John
  Date: 2019/10/24
  Time: 11:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>图书列表</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <script type="text/javascript" src="/static/layui/layui.js"></script>
</head>
<body>

<table id="userListTable"></table>

</body>
<script type="text/javascript">
    //一般直接写在一个js文件中
    layui.use(['table'], function(){
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#userListTable'
            ,height: 'full-20'  //高度最大化减去差值，参见layui官方说明：https://www.layui.com/doc/modules/table.html#height
            ,url: '/rest/book/list' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'bookNo', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'bookName', title: '书名', width:80}
                ,{field: 'author', title: '作者', width:80, sort: true}
                ,{field: 'bookType', title: '类型', width:80}
            ]]
        });
    });

</script>
</html>
